package com.hrrt.home.rpc.service.impl;


import com.github.pagehelper.PageHelper;
import com.hrrt.common.annotation.BaseService;
import com.hrrt.common.base.BaseServiceImpl;
import com.hrrt.home.dao.mapper.HomeBrandMapper;
import com.hrrt.home.dao.model.HomeBrand;
import com.hrrt.home.dao.model.HomeBrandExample;
import com.hrrt.home.rpc.api.HomeBrandService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
* HomeBrandService实现
* Created by shuzheng on 2017/9/1.
*/
@Service
@Transactional
@BaseService
public class HomeBrandServiceImpl extends BaseServiceImpl<HomeBrandMapper, HomeBrand, HomeBrandExample> implements HomeBrandService {

    private static Logger _log = LoggerFactory.getLogger(HomeBrandServiceImpl.class);

    @Autowired
    HomeBrandMapper homeBrandMapper;

    @Override
    public List<HomeBrand> selectByExampleWithNameForOffsetPage(HomeBrandExample homeBrandExample, int offset, int limit) {
        List<HomeBrand> list = null;
        try {
            PageHelper.offsetPage(offset, limit, false);
            list = homeBrandMapper.selectByExampleWithName(homeBrandExample);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return list;
    }

    @Override
    public List<HomeBrand> selectOrderByExampleWithNameForOffsetPage(HomeBrandExample homeBrandExample, int offset, int limit) {
        List<HomeBrand> list = null;
        try {
            PageHelper.offsetPage(offset, limit, false);
            list = homeBrandMapper.selectOrederByExampleWithName(homeBrandExample);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return list;
    }
}